#include "../comm.h"

class Solution {
public:
    int minimumRounds(vector<int>& tasks) {
        unordered_map<int, int> cnts;
        for(auto e: tasks)
            cnts[e]++;
        int num = 0;
        for(const auto& [k, v]: cnts)
            if(v == 1) return -1;
            else
            {
                int tt = v % 3;
                if(!tt) num += v / 3;
                else num += v / 3 + 1;
            }
        return num;
    }
};